From 3466fd5238bd14797d368ce55624580501d79ae2 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Wed, 21 Aug 2013 04:24:40 +0000 Subject: [PATCH] Convert remaining users (glogbook, hiketech) of xmlgeneric writer to XMLStreamwriter. Drop a whole lot of (kinda dumb) code. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4549 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/coastexp.cc | 729 ----------------------------------------- gpsbabel/geo.cc | 5 +- gpsbabel/glogbook.cc | 47 ++- gpsbabel/hiketech.cc | 74 +++-- gpsbabel/hsa_ndv.cc | 510 ---------------------------- gpsbabel/xmlgeneric.cc | 83 ----- gpsbabel/xmlgeneric.h | 17 - 7 files changed, 75 insertions(+), 1390 deletions(-) delete mode 100644 gpsbabel/coastexp.cc delete mode 100644 gpsbabel/hsa_ndv.cc diff --git a/gpsbabel/coastexp.cc b/gpsbabel/coastexp.cc deleted file mode 100644 index 7874b09b4..000000000 --- a/gpsbabel/coastexp.cc +++ /dev/null @@ -1,729 +0,0 @@ -/* - Copyright (C) 2004 Justin Broughton, justinbr@earthlink.net - Copyright (C) 2007 Robert Lipe, robertlipe@gpsbabel.org - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - */ - -#include - -#include "defs.h" -#include "xmlgeneric.h" -#if HAVE_LIBEXPAT -# include -static XML_Parser psr; -#endif - -#include -#include "cet_util.h" - -#include "uuid.h" - -static gbfile* fd, *ofd; - -#define MYNAME "coastexp" -#define MY_CBUF 4096 -#define MY_UBUF 128 -#define MY_TBUF 64 -#define MY_XBUF 128 - - -static char* element; // Current element being parsed -static char* cdatastr; // Current XML character data being built up (until a ) - -/* CE-specific mark structure - used for both route marks and standalone marks */ -struct CE_MARK { - queue Q; - char* id; // CE's mark ID (of the form "{}") - char* created; // CE's creation time (of the form "
TZ") - waypoint* wp; // GPSBabel waypoint - int used; // Is this mark used in a route or not? -}; -typedef struct CE_MARK ce_mark; - -/* CE-specific route structure */ -struct CE_ROUTE { - queue Q; - char* id; // CE's route ID (of the form "{}") - route_head* r; // GPSBabel route header - queue ce_mark_head; // list of CE marks in this route -}; -typedef struct CE_ROUTE ce_route; - -static queue ce_route_head; // List of routes currently found -static ce_route* currentRoute = NULL; // Current route being processed -static queue ce_mark_head; // List of stand-alone marks currently found -static ce_mark* currentMark = NULL; // Current mark being processed -static char* uuid_buffer = NULL; // UUID buffer for processing uuid's -static char* xml_buffer = NULL; // XML buffer for processing XML strings -static int inRoute = 0; // Are we processing a route? -static int inMark = 0; // Are we processing a mark? - -/* Add a route to the list of routes */ -static void -ce_add_route(ce_route* route) -{ - ENQUEUE_TAIL(&ce_route_head, &route->Q); -} - -/* Add a mark to the list of stand-alone marks */ -static void -ce_add_mark(ce_mark* mark) -{ - ENQUEUE_TAIL(&ce_mark_head, &mark->Q); -} - -/* Add a mark to the specified route */ -static void -ce_add_mark_to_route(ce_route* route, ce_mark* mark) -{ - ENQUEUE_TAIL(&route->ce_mark_head, &mark->Q); -} - -/* Free a mark */ -static void -ce_free_mark(ce_mark* mark) -{ - dequeue(&mark->Q); - if (mark->id) { - xfree(mark->id); - } - if (mark->created) { - xfree(mark->created); - } - xfree(mark); -} - -/* Free a route */ -static void -ce_free_route(ce_route* route) -{ - queue* elem, *tmp; - QUEUE_FOR_EACH(&route->ce_mark_head, elem, tmp) { - ce_mark* mark = (ce_mark*) elem; - ce_free_mark(mark); - } - xfree(route->id); - xfree(route); - // Don't free the waypoint since this is done elsewhere -} - -/* Allocate a mark */ -static ce_mark* -ce_alloc_mark(const waypoint* wpt, const char* id) -{ - ce_mark* res = (ce_mark*) xcalloc(sizeof(ce_mark), 1); - res->id = (char*) id; - res->wp = (waypoint*) wpt; - return res; -} - -#if !HAVE_LIBEXPAT -void -ce_rd_init(const char* fname) -{ - fatal(MYNAME ": This build excluded CoastalExplorer support because expat was not installed.\n"); -} - -void -ce_read(void) -{ -} -#else - -/* Start processing an XML item */ -static void -ce_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr) -{ - const char* el = xml_convert_to_char_string(xml_el); - const char** ap; - const char** attr; - - attr = xml_convert_attrs_to_char_string(xml_attr); - strcpy(element, el); - if (0 == strcmp(el, "Route")) { - inRoute = 1; - for (ap = attr; *ap; ap+=2) { - if (0 == strcmp(ap[0], "id")) { - // Create a CE route object and add it to the list of routes - currentRoute = (ce_route*) xcalloc(sizeof(ce_route), 1); - currentRoute->id=xstrdup(ap[1]); - currentRoute->r = route_head_alloc(); - QUEUE_INIT(¤tRoute->ce_mark_head); - ce_add_route(currentRoute); - } - } - } else if (0 == strcmp(el, "Mark")) { - inMark = 1; - currentMark = ce_alloc_mark(NULL, NULL); - ce_add_mark(currentMark); - for (ap = attr; *ap; ap+=2) { - if (0 == strcmp(ap[0], "id")) { - // Create a CE mark object and add it to the list of stand-alone marks - currentMark->id = xstrdup(ap[1]); - } else if (0 == strcmp(ap[0], "created")) { - currentMark->created = xstrdup(ap[1]); - } - } - } - xml_free_converted_string(el); - xml_free_converted_attrs(attr); -} - -/* Finish processing an XML item */ -static void -ce_end(void* data, const XML_Char* xml_el) -{ - const char* el = xml_convert_to_char_string(xml_el); - if (0 == strcmp(el, "Route")) { - inRoute = 0; /* ??? */ - } else if (0 == strcmp(el, "Mark")) { - inMark = 0; - } - xml_free_converted_string(el); -} - -/* Process some XML character data for the current item */ -static void -ce_cdata(void* dta, const XML_Char* xml_s, int len) -{ - const char* origs = xml_convert_to_char_string_n(xml_s, &len); - const char* s = origs; - if (*s != '\n') { - char* edatastr; - // We buffer up characters in 'cdatastr' until a single is received - if ((strlen(cdatastr) + len) > MY_CBUF) { - printf("Buffer overflow - line too long!"); - exit(-1); - } - edatastr = cdatastr+strlen(cdatastr); - memcpy(edatastr, s, len); - edatastr[len] = '\0'; - } else { - // Now process what we have in 'cdatastr' - s = cdatastr; - while (*s != '\0' && (*s == '\b' || *s == '\t')) { - s++; - } - if (strlen(s) <= 0) { - return; - } - if (0 == strcmp(element, "Marks")) { - if (inRoute) { - // We are processing the marks in a route so create a CE mark object - // and add it to the current route - ce_mark* mark = (ce_mark*) ce_alloc_mark(NULL, xstrdup(s)); - ce_add_mark_to_route(currentRoute, mark); - } - } else if (0 == strcmp(element, "Position")) { - if (inMark) { - // We are processing a standalone mark so read the lat/long position - // and create a waypoint to add to the current mark - char* position = xstrdup(s); - char* lat = position; - char* latNorS = position; - char* lng; - char* longEorW; - while (*latNorS != ' ') { - latNorS++; - } - *latNorS++ = '\0'; - lng = latNorS; - lng++; - lng++; - longEorW = lng; - while (*longEorW != ' ') { - longEorW++; - } - *longEorW++ = '\0'; - if (!currentMark->wp) { - currentMark->wp = waypt_new(); - } - currentMark->wp->latitude = atof(lat); - if (*latNorS == 'S') { - currentMark->wp->latitude = -currentMark->wp->latitude; - } - currentMark->wp->longitude = atof(lng); - if (*longEorW == 'W') { - currentMark->wp->longitude = -currentMark->wp->longitude; - } - xfree(position); - } - } else if (0 == strcmp(element, "Name")) { - // Names we care about may be either for routes or marks - if (inMark) { - if (!currentMark->wp) { - currentMark->wp = waypt_new(); - } - currentMark->wp->shortname = xstrdup(s); - - // Also set the creation time - if (currentMark->created) { - struct tm t; - char yearString[5], monthString[3], dayString[3], hourString[3], minString[3], secString[3]; - memset(&t, 0, sizeof(struct tm)); - strncpy(yearString, currentMark->created, 4); - yearString[4] = '\0'; - t.tm_year = atoi(yearString) - 1900; - strncpy(monthString, currentMark->created+4, 2); - monthString[2] = '\0'; - t.tm_mon = atoi(monthString) - 1; - strncpy(dayString, currentMark->created+6, 2); - dayString[2] = '\0'; - t.tm_mday = atoi(dayString); - strncpy(hourString, currentMark->created+9, 2); - hourString[2] = '\0'; - t.tm_hour = atoi(hourString); - strncpy(minString, currentMark->created+11, 2); - minString[2] = '\0'; - t.tm_min = atoi(minString); - strncpy(secString, currentMark->created+13, 2); - secString[2] = '\0'; - t.tm_sec = atoi(secString); - currentMark->wp->SetCreationTime(mkgmtime(&t)); - } - } else if (inRoute) { - currentRoute->r->rte_name = xstrdup(s); - } - } else if (0 == strcmp(element, "Description")) { - // Descriptions we care about may be either for routes or marks - char* desc = xstrdup(s); - if (inMark) { - if (!currentMark->wp) { - currentMark->wp = waypt_new(); - } - currentMark->wp->description = desc; - } else if (inRoute) { - currentRoute->r->rte_desc = desc; - } - } - - // Start building a new string since we are done with this one - cdatastr[0] = '\0'; - } - - xml_free_converted_string(origs); -} - -/* Set up reading the CE input file */ -void -ce_rd_init(const char* fname) -{ - fd = gbfopen(fname, "r", MYNAME); - QUEUE_INIT(&ce_route_head); - QUEUE_INIT(&ce_mark_head); - - psr = XML_ParserCreate(NULL); - if (!psr) { - fatal(MYNAME ":Cannot create XML parser\n"); - } - - XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL); - XML_SetElementHandler(psr, ce_start, ce_end); - cdatastr = (char*) xcalloc(MY_CBUF,1); - element = (char*) xcalloc(MY_CBUF,1); - XML_SetCharacterDataHandler(psr, ce_cdata); -} - -/* Parse the input file */ -void -ce_read(void) -{ - int len; - char buf[MY_CBUF + 1]; - - while ((len = gbfread(buf, 1, sizeof(buf) - 1, fd))) { - buf[len] = '\0'; - if (!XML_Parse(psr, buf, len, gbfeof(fd))) { - fatal(MYNAME ":Parse error at %d: %s\n", - (int) XML_GetCurrentLineNumber(psr), - XML_ErrorString(XML_GetErrorCode(psr))); - } - } - - XML_ParserFree(psr); -} - -#endif - -/* Fix waypoints in route marks from the standalone marks */ -void -ce_fix_route_mark_waypoints(void) -{ - queue* elem, *tmp; - QUEUE_FOR_EACH(&ce_route_head, elem, tmp) { - ce_route* route = (ce_route*) elem; - queue* elem2, *tmp2; - QUEUE_FOR_EACH(&route->ce_mark_head, elem2, tmp2) { - ce_mark* mark = (ce_mark*) elem2; - queue* elem3, *tmp3; - QUEUE_FOR_EACH(&ce_mark_head, elem3, tmp3) { - ce_mark* mark2 = (ce_mark*) elem3; - if (0 == strcmp(mark->id, mark2->id)) { - mark->wp = waypt_dupe(mark2->wp); - mark2->used = 1; - break; - } - } - } - } -} - -/* Check route name and if NULL assign a name */ -void -ce_check_route_names(void) -{ - queue* elem, *tmp; - QUEUE_FOR_EACH(&ce_route_head, elem, tmp) { - ce_route* route = (ce_route*) elem; - if (route->r->rte_name == NULL) { - *cdatastr = '\0'; - if (!QUEUE_EMPTY(&route->ce_mark_head)) { - strcat(cdatastr, ((ce_mark*) QUEUE_FIRST(&route->ce_mark_head))->wp->shortname); - strcat(cdatastr, "->"); - strcat(cdatastr, ((ce_mark*) QUEUE_LAST(&route->ce_mark_head))->wp->shortname); - } - route->r->rte_name = xstrdup(cdatastr); - } - } -} - -/* Remove marks used in routes */ -void -ce_remove_used_marks(void) -{ - queue* elem, *tmp; - QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark* mark = (ce_mark*) elem; - if (mark->used) { - if (mark->wp) { - waypt_free(mark->wp); - } - ce_free_mark(mark); - } - } -} - -/* Print out results */ -void -ce_print_results(void) -{ - queue* elem, *tmp; - QUEUE_FOR_EACH(&ce_route_head, elem, tmp) { - queue* elem2, *tmp2; - ce_route* route = (ce_route*) elem; - printf("Route name=%s id=%s\n", route->r->rte_name, route->id); - QUEUE_FOR_EACH(&route->ce_mark_head, elem2, tmp2) { - ce_mark* mark = (ce_mark*) elem2; - if (mark->wp == NULL) { - printf(" null\n"); - } else { - printf(" %s (%f, %f)\n", mark->wp->shortname, mark->wp->latitude, mark->wp->longitude); - } - } - } - - QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark* mark = (ce_mark*) elem; - printf("Mark name=%s id=%s ", mark->wp->shortname, mark->id); - if (mark->wp == NULL) { - printf("(null)\n"); - } else { - printf("(%f, %f)\n", mark->wp->latitude, mark->wp->longitude); - } - } -} - -/* Finish reading the input file */ -void -ce_rd_deinit(void) -{ - /* If doing routes, we create GPSBabel route structures and waypoint structures for - any standalone waypoints. - If doing waypoints, we create only waypoint structures for both route waypoints and - standalone waypoints. - */ - queue* elem, *tmp; - - ce_fix_route_mark_waypoints(); - ce_check_route_names(); - ce_remove_used_marks(); - - // Log results - if (global_opts.debug_level > 1) { - ce_print_results(); - } - - // Add routes to GPSBabel - QUEUE_FOR_EACH(&ce_route_head, elem, tmp) { - ce_route* route = (ce_route*) elem; - queue* elem2, *tmp2; - route_add_head(route->r); - QUEUE_FOR_EACH(&route->ce_mark_head, elem2, tmp2) { - ce_mark* mark = (ce_mark*) elem2; - if (mark->wp) { - route_add_wpt(route->r, mark->wp); - } else { - printf("Undefined mark: %s\n", mark->id); - } - } - ce_free_route(route); - } - - // Add (unused) marks to GPSBabel - QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark* mark = (ce_mark*) elem; - waypt_add(mark->wp); - ce_free_mark(mark); - } - - gbfclose(fd); - xfree(element); - xfree(cdatastr); -} - -/* Setup for writing */ -void -ce_wr_init(const char* fname) -{ - QUEUE_INIT(&ce_mark_head); - - // Alloocate all buffers used for writing - uuid_buffer = (char*) xcalloc(MY_UBUF,1); - xml_buffer = (char*) xcalloc(MY_XBUF, 1); - - ofd = gbfopen(fname, "w", MYNAME); - srand(gpsbabel_now); -} - -void -ce_wr_deinit(void) -{ - gbfclose(ofd); - - // Free the buffers used for writing - xfree(uuid_buffer); - xfree(xml_buffer); -} - -/* Generate a CE-style creation time based on supplied time */ -static QString -ce_gen_creation_time(time_t tm) -{ - QDateTime qtm; - qtm = QDateTime::fromTime_t(tm); - return qtm.toUTC().toString("yyyyMMddTHHmmssZ"); -} - -/* Generate a CE-style creation time based on current time */ -static QString -ce_gen_current_time(void) -{ - return ce_gen_creation_time(current_time().toTime_t()); -} - -/* Generate a UUID (has same format as Microsoft registry GUIDs */ -static char* -ce_gen_uuid(void) -{ - uuid_t uu; - - memset(&uu, 0, sizeof(uu)); - gb_uuid_generate(uu); - sprintf(uuid_buffer, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - uu[0], uu[1], uu[2], uu[3], uu[4], uu[5], uu[6], uu[7], - uu[8], uu[9], uu[10], uu[11], uu[12], uu[13], uu[14], uu[15]); - return uuid_buffer; -} - -/* Generate route header XML */ -static void -ce_route_hdr(const route_head* rte) -{ - sprintf(xml_buffer, "{%s}", ce_gen_uuid()); - write_xml_entity_begin2(ofd, "\t", "Route", "created", ce_gen_current_time(), "id", xml_buffer); - write_xml_entity_begin0(ofd, "\t\t", "Marks"); -} - -/* Generate route body XML */ -static void -ce_route_disp(const waypoint* waypointp) -{ - char* uuid = ce_gen_uuid(); - char* id = (char*) xcalloc(strlen(uuid)+3, 1); - - sprintf(id, "{%s}", uuid); - currentMark = ce_alloc_mark(waypointp, id); - ENQUEUE_TAIL(&ce_mark_head, ¤tMark->Q); - - gbfprintf(ofd, "\t\t\t%s\n", id); // CE's departure from XML standard! -} - -/* Generate route trailer XML */ -static void -ce_route_tlr(const route_head* rte) -{ - write_xml_entity_end(ofd, "\t\t", "Marks"); - write_optional_xml_entity(ofd, "\t\t", "Name", rte->rte_name); - write_xml_entity_end(ofd, "\t", "Route"); -} - -/* Generate waypoint body XML */ -static void -ce_waypt_pr(const waypoint* wp) -{ - double latitude = wp->latitude; - char NorS = 'N'; - char EorW = 'E'; - double longitude = wp->longitude; - - if (latitude < 0) { - latitude = -latitude; - NorS = 'S'; - } - if (longitude < 0) { - longitude = -longitude; - EorW = 'W'; - } - sprintf(xml_buffer, "%3.6f %c %3.6f %c", latitude, NorS, longitude, EorW); - write_xml_entity(ofd, "\t\t", "Position", xml_buffer); - write_optional_xml_entity(ofd, "\t\t", "Name", wp->shortname); - if (wp->description && wp->shortname && - strcmp(wp->description, wp->shortname)) { - write_optional_xml_entity(ofd, "\t\t", "Description", wp->description); - } -} - -static char* -ce_find_uuid(const waypoint* wpt) -{ - queue* elem, *tmp; - - QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark* mark = (ce_mark*) elem; - if (mark->wp == wpt) { - return mark->id; - } - } - return NULL; -} - -static waypoint* -ce_find_wpt(const waypoint* wpt) -{ - queue* elem, *tmp; - - QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark* mark = (ce_mark*) elem; - if ((mark->wp->shortname == wpt->shortname) && - (mark->wp->latitude == wpt->latitude) && - (mark->wp->longitude == wpt->longitude)) { - return mark->wp; - } - } - return NULL; -} - -/* Generate a mark XML; look for created id's */ -static void -ce_mark_pr(const waypoint* wp) -{ - char* id; - - if (inRoute) { - id = ce_find_uuid(wp); - if (id == NULL) { - sprintf(xml_buffer, "{%s}", ce_gen_uuid()); - id = xml_buffer; - } - } - /* Have we seen and written the (nearly) same waypoint ? */ - else if (ce_find_wpt(wp) != NULL) { - return; - } else { - ce_mark* mark = ce_alloc_mark(wp, NULL); - ENQUEUE_TAIL(&ce_mark_head, &mark->Q); - sprintf(xml_buffer, "{%s}", ce_gen_uuid()); - id = xml_buffer; - } - write_xml_entity_begin2(ofd, "\t", "Mark", - "created", ce_gen_creation_time(wp->GetCreationTime().toTime_t()), - "id", id); - ce_waypt_pr(wp); - write_xml_entity_end(ofd, "\t", "Mark"); -} - -/* Generate all route marks */ -static void -ce_marks_pr(void) -{ - queue* elem, *tmp; - - QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark* mark = (ce_mark*) elem; - ce_mark_pr(mark->wp); - } -} - -/* Release all generated marks */ -static void -ce_marks_flush_all(void) -{ - queue* elem, *tmp; - - QUEUE_FOR_EACH(&ce_mark_head, elem, tmp) { - ce_mark* mark = (ce_mark*) elem; - ce_free_mark(mark); - } -} - -/* Write all routes and marks */ -void -ce_write(void) -{ - /* If doing routes, we write out the routes and all the standalone waypoints. - If doing waypoints, we write out the route waypoints (without the routes) and - the standalone waypoints. - */ - write_xml_header(ofd); - write_xml_entity_begin1(ofd, "", "NavObjectCollection", "created", - ce_gen_current_time()); - write_xml_entity(ofd, "\t", "Name", "Navigation Objects"); - - inRoute = 1; - route_disp_all(ce_route_hdr, ce_route_tlr, ce_route_disp); - ce_marks_pr(); - inRoute = 0; - - waypt_disp_all(ce_mark_pr); - ce_marks_flush_all(); - - write_xml_entity_end(ofd, "", "NavObjectCollection"); -} - -ff_vecs_t coastexp_vecs = { - ff_type_file, - { (ff_cap)(ff_cap_read|ff_cap_write), ff_cap_none, (ff_cap)(ff_cap_read|ff_cap_write) }, - ce_rd_init, - ce_wr_init, - ce_rd_deinit, - ce_wr_deinit, - ce_read, - ce_write, - NULL, - NULL, - CET_CHARSET_ASCII, 0 /* CET-REVIEW */ -}; diff --git a/gpsbabel/geo.cc b/gpsbabel/geo.cc index 102027d2b..4fc7f239b 100644 --- a/gpsbabel/geo.cc +++ b/gpsbabel/geo.cc @@ -28,8 +28,9 @@ static gbfile* ofd; #include #include #include "src/core/file.h" -QString ostring; -QXmlStreamWriter writer(&ostring); + +static QString ostring; +static QXmlStreamWriter writer(&ostring); static arglist_t geo_args[] = { diff --git a/gpsbabel/glogbook.cc b/gpsbabel/glogbook.cc index fed772e63..9d4e85240 100644 --- a/gpsbabel/glogbook.cc +++ b/gpsbabel/glogbook.cc @@ -20,15 +20,19 @@ */ #include +#include #include "defs.h" #include "xmlgeneric.h" +#include "src/core/file.h" static gbfile* ofd; +static QString ostring; +static QXmlStreamWriter writer(&ostring); + static waypoint* wpt_tmp; static route_head* trk_head; - #define MYNAME "glogbook" static @@ -78,52 +82,61 @@ static void glogbook_wr_init(const char* fname) { ofd = gbfopen(fname, "w", MYNAME); + writer.setAutoFormatting(true); + writer.setAutoFormattingIndent(4); + writer.writeStartDocument(); } static void glogbook_wr_deinit(void) { + writer.writeEndDocument(); + gbfputs(ostring,ofd); gbfclose(ofd); + ofd = NULL; } static void glogbook_waypt_pr(const waypoint* wpt) { - gbfprintf(ofd, " \n"); - gbfprintf(ofd, " \n"); - gbfprintf(ofd, " %.5f\n", wpt->latitude); - gbfprintf(ofd, " %.5f\n", wpt->longitude); - if (wpt->altitude != unknown_alt) { - gbfprintf(ofd, " %.3f\n", wpt->altitude); - } - gbfprintf(ofd, " \n"); - gbfprintf(ofd, " "); - QDateTime dt = wpt->GetCreationTime(); - xml_write_time(ofd, dt, "Time"); - gbfprintf(ofd, " \n"); + writer.writeStartElement("Trackpoint"); + + writer.writeStartElement("Position"); + writer.writeTextElement("Latitude", QString::number(wpt->latitude,'f', 5)); + writer.writeTextElement("Longitude", QString::number(wpt->longitude,'f', 5)); + writer.writeTextElement("Altitude", QString::number(wpt->altitude,'f', 3)); + writer.writeEndElement(); // Position + + writer.writeTextElement("Time", wpt->GetCreationTime().toPrettyString()); + writer.writeEndElement(); // Trackpoint } static void glogbook_hdr(const route_head* rte) { - gbfprintf(ofd, " \n"); + writer.writeStartElement("Track"); } static void glogbook_ftr(const route_head* rte) { - gbfprintf(ofd, " \n"); + writer.writeEndElement(); } static void glogbook_write(void) { +#if 0 gbfprintf(ofd, "\n"); gbfprintf(ofd, "\n"); gbfprintf(ofd, " \n"); +#else + writer.writeStartElement("History"); + writer.writeStartElement("Run"); +#endif track_disp_all(glogbook_hdr, glogbook_ftr, glogbook_waypt_pr); - gbfprintf(ofd, " \n"); - gbfprintf(ofd, "\n"); + writer.writeEndElement(); // Run + writer.writeEndElement(); // History } void gl_trk_s(const char* args, const QXmlStreamAttributes* unused) diff --git a/gpsbabel/hiketech.cc b/gpsbabel/hiketech.cc index 7f9488fff..d1be6f227 100644 --- a/gpsbabel/hiketech.cc +++ b/gpsbabel/hiketech.cc @@ -20,15 +20,19 @@ */ #include +#include "src/core/xmlstreamwriter.h" + #include "defs.h" #include "xmlgeneric.h" static gbfile* ofd; +static QString ostring; +static gpsbabel::XmlStreamWriter writer(&ostring); + static waypoint* wpt_tmp; static route_head* trk_head; - #define MYNAME "hiketech" static @@ -97,78 +101,84 @@ static void hiketech_wr_init(const char* fname) { ofd = gbfopen(fname, "w", MYNAME); + } static void hiketech_wr_deinit(void) { + writer.writeEndDocument(); + gbfputs(ostring, ofd); gbfclose(ofd); + ofd = NULL; } static void hiketech_trk_hdr(const route_head* rte) { - gbfprintf(ofd, "\n"); - write_optional_xml_entity(ofd, " ", "ident", rte->rte_name); + writer.writeStartElement("trk"); + writer.setAutoFormattingIndent(1); + writer.writeOptionalTextElement("ident", rte->rte_name); } static void hiketech_trk_tlr(const route_head* rte) { - gbfprintf(ofd, "\n"); + writer.writeEndElement(); // trk } -static void -hiketech_print_utc(time_t tm, const char* indent, const char* tag) +static QString +hiketech_format_time(const QDateTime& t) { - char tbuf[80]; - strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %I:%M:%S", gmtime(&tm)); - gbfprintf(ofd, "%s<%s>%s\n",indent,tag,tbuf,tag); + return t.toString("yyyy-MM-dd hh:mm:ss"); } static void hiketech_trkpt_pr(const waypoint* waypointp) { - gbfprintf(ofd, " \n"); + writer.writeStartElement("pnt"); if (waypointp->creation_time.isValid()) { - hiketech_print_utc(waypointp->GetCreationTime().toTime_t(), " ", "utc"); + writer.writeTextElement("utc", + hiketech_format_time(waypointp->GetCreationTime())); } - gbfprintf(ofd, " %f\n", waypointp->latitude); - gbfprintf(ofd, " %f\n", waypointp->longitude); + writer.writeTextElement("lat", QString::number(waypointp->latitude,'f', 6)); + writer.writeTextElement("long", QString::number(waypointp->longitude,'f', 6)); if (waypointp->altitude != unknown_alt) { - gbfprintf(ofd, " %f\n", - waypointp->altitude); + writer.writeTextElement("alt", QString::number(waypointp->altitude,'f', 6)); } - gbfprintf(ofd, " \n"); + writer.writeEndElement(); // png } static void hiketech_waypt_pr(const waypoint* wpt) { - gbfprintf(ofd, "\n"); - write_xml_entity(ofd, "\t", "ident", wpt->shortname); - write_optional_xml_entity(ofd, "\t", "sym", wpt->icon_descr); - gbfprintf(ofd, "\t%f\n", wpt->latitude); - gbfprintf(ofd, "\t%f\n", wpt->longitude); - - /* - * These probably aren't technicallyconstants, but it's all - * we can do for now. - */ - gbfprintf(ofd, "\t\n\t\tFAFFB4\n\t\tFF8000\n\t\n"); - gbfprintf(ofd, "\n"); + writer.writeStartElement("wpt"); + writer.setAutoFormattingIndent(-1); + writer.writeTextElement("ident", wpt->shortname); + writer.writeTextElement("sym", wpt->icon_descr); + writer.writeTextElement("lat", QString::number(wpt->latitude, 'f', 6)); + writer.writeTextElement("long", QString::number(wpt->longitude, 'f', 6)); + writer.writeStartElement("color"); + writer.writeTextElement("lbl", "FAFFB4"); + writer.writeTextElement("obj", "FF8000"); + writer.writeEndElement(); // color + + writer.writeEndElement(); // wpt } static void hiketech_write(void) { - gbfprintf(ofd, "\n"); - gbfprintf(ofd, "\n"); + writer.writeStartElement("hiketech"); + writer.writeAttribute("version", "1.2"); + writer.writeAttribute("url", "http://www.hiketech.com"); + writer.setAutoFormatting(true); + writer.writeStartElement("gpsdata"); track_disp_all(hiketech_trk_hdr, hiketech_trk_tlr, hiketech_trkpt_pr); track_disp_all(NULL, NULL, hiketech_trkpt_pr); waypt_disp_all(hiketech_waypt_pr); - gbfprintf(ofd, "\n"); - gbfprintf(ofd, "\n"); + writer.writeEndElement(); // gpsdata + writer.writeEndElement(); // hiketech } static diff --git a/gpsbabel/hsa_ndv.cc b/gpsbabel/hsa_ndv.cc deleted file mode 100644 index 7aef17962..000000000 --- a/gpsbabel/hsa_ndv.cc +++ /dev/null @@ -1,510 +0,0 @@ -/* - Copyright (C) 2004 HSA Systems, Sven Dowideit - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA - - */ -#include "defs.h" -#include "cet_util.h" -#if HAVE_LIBEXPAT -#include -static XML_Parser psr; -#endif - -static char* cdatastr; -static int in_Route = 0; -static int in_ChartWork = 0; -static int in_Object = 0; - -static waypoint* wpt_tmp; -static const char* routeName = "ROUTENAME"; - -#define REPLACEMENT_SIRIUS_ATTR_SEPARATOR ';' -#define ATTR_USRMRK "usrmrk" -#define ATTR_OBJECTNAME "OBJNAM" -#define ATTR_SHIPNAME "shpnam" - -static void readVersion4(gbfile* pFile); -static void getAttr(const char* data, const char* attr, char** val, char seperator); - -static gbfile* fd; -static gbfile* ofd; - -static -arglist_t hsa_ndv_args[] = { - ARG_TERMINATOR -}; - -#define MYNAME "HsaNdv" -#define MY_CBUF 4096 - - -#if ! HAVE_LIBEXPAT -static void -hsa_ndv_rd_init(const char* fname) -{ - fatal(MYNAME ": This build excluded HSA Endeavour support because expat was not installed.\n"); -} - -static void -hsa_ndv_read(void) -{ -} -#else - -static void -hsa_ndv_start(void* data, const XML_Char* xml_el, const XML_Char** attr) -{ - const char* el = xml_convert_to_char_string(xml_el); - -// printf("<%s>\n", el); - if (strcmp(el, "Export") == 0) { - //should only be one - } else if (strcmp(el, "Route") == 0) { - in_Route++; - } else if (strcmp(el, "Chartwork") == 0) { - in_ChartWork++; - } else if (strcmp(el, "Object") == 0) { - wpt_tmp = waypt_new(); - wpt_tmp->altitude = unknown_alt; - in_Object++; - } - //reset data :) - memset(cdatastr,0, MY_CBUF); - xml_free_converted_string(el); -} - -static void -hsa_ndv_end(void* data, const XML_Char* xml_el) -{ - const char* el = xml_convert_to_char_string(xml_el); - if (in_Route) { - if (strcmp(el, "Version") == 0) { - //don't really care - } else if (strcmp(el, "Name") == 0) { - routeName = xstrdup(cdatastr); - } else if (strcmp(el, "LastModified") == 0) { - //don't really care - } - if (in_Object) { - if (strcmp(el, "ClassName") == 0) { - } else if (strcmp(el, "Attr") == 0) { - getAttr(cdatastr, ATTR_OBJECTNAME, &wpt_tmp->shortname, REPLACEMENT_SIRIUS_ATTR_SEPARATOR); - getAttr(cdatastr, ATTR_USRMRK, &wpt_tmp->description, REPLACEMENT_SIRIUS_ATTR_SEPARATOR); - } else if (strcmp(el, "LegAttr") == 0) { - } else if (strcmp(el, "NumberOfVertexs") == 0) { - } else if (strcmp(el, "Latitude") == 0) { - wpt_tmp->latitude = atof(cdatastr); - } else if (strcmp(el, "Longitude") == 0) { - wpt_tmp->longitude = atof(cdatastr); - } - } - } - - if (in_ChartWork) { - if (strcmp(el, "Version") == 0) { - //don't really care - } - if (in_Object) { - if (strcmp(el, "ClassName") == 0) { -// className = xstrdup(cdatastr); - } else if (strcmp(el, "Attr") == 0) { - //getAttr(cdatastr, ATTR_OBJECTNAME, &wpt_tmp->shortname, REPLACEMENT_SIRIUS_ATTR_SEPARATOR); - //getAttr(cdatastr, ATTR_SHIPNAME, &wpt_tmp->description, REPLACEMENT_SIRIUS_ATTR_SEPARATOR); - } else if (strcmp(el, "NumberOfVertexs") == 0) { - } else if (strcmp(el, "Latitude") == 0) { - wpt_tmp->latitude = atof(cdatastr); - } else if (strcmp(el, "Longitude") == 0) { - wpt_tmp->longitude = atof(cdatastr); - } else if (strcmp(el, "Time") == 0) { - wpt_tmp->SetCreationTime(atoi(cdatastr)); - } - } - } - - //ignore everything else for now.. - memset(cdatastr,0, MY_CBUF); - - if (strcmp(el, "Object") == 0) { - if (in_Route) { - waypt_add(wpt_tmp); - } else if (in_ChartWork) { - //TODO: not sure how i want to handle this.. - } - in_Object--; - } else if (strcmp(el, "Route") == 0) { - in_Route--; - } else if (strcmp(el, "Chartwork") == 0) { - in_ChartWork--; - } - xml_free_converted_string(el); -} - -static void -hsa_ndv_cdata(void* dta, const XML_Char* s, int len) -{ - char* estr; - estr = cdatastr + strlen(cdatastr); - memcpy(estr, s, len); -} - -static void -hsa_ndv_rd_init(const char* fname) -{ - fd = gbfopen(fname, "r", MYNAME); - - psr = XML_ParserCreate(NULL); - if (!psr) { - fatal(MYNAME ":Cannot create XML parser\n"); - } - - XML_SetUnknownEncodingHandler(psr, cet_lib_expat_UnknownEncodingHandler, NULL); - XML_SetElementHandler(psr, hsa_ndv_start, hsa_ndv_end); - cdatastr = (char*) xcalloc(MY_CBUF,1); - XML_SetCharacterDataHandler(psr, hsa_ndv_cdata); -} - -static void -hsa_ndv_read(void) -{ - int len; - char buf[MY_CBUF + 1]; - - while ((len = gbfread(buf, 1, sizeof(buf) - 1, fd))) { - char* bad; - - buf[len] = '\0'; - if (NULL != strstr(buf, "nver=1")) { - //its the older format, not xml - gbfseek(fd, 0, SEEK_SET); - readVersion4(fd); - break; - } - //grumble - have to remove \x1f's from sirius attributes - bad = buf; - while (NULL != (bad = strchr(bad, '\x1f'))) { - *bad = REPLACEMENT_SIRIUS_ATTR_SEPARATOR; - } - if (!XML_Parse(psr, buf, len, gbfeof(fd))) { - fatal(MYNAME ":Parse error at %d: %s\n", - (int) XML_GetCurrentLineNumber(psr), - XML_ErrorString(XML_GetErrorCode(psr))); - } - } - - XML_ParserFree(psr); -} - -#endif - -static void getAttr(const char* data, const char* attr, char** val, char seperator) -{ - const char* start; - if ((start = strstr(data, attr)) != NULL) { - const char* end; - int len; - - end = strchr(start, seperator); - if (end == NULL) { - end = start + strlen(start);//assume we are teh last attr - } - - len = end-start - strlen(attr); - - *val = (char*) xcalloc(len+1, 1); - memcpy(*val, start+strlen(attr), len); - (*val)[len] = '\0'; - } else { - *val = (char*) xcalloc(1, 1); - (*val)[0] = '\0'; - } -} -static void -hsa_ndv_rd_deinit(void) -{ - if (cdatastr) { - xfree(cdatastr); - } - gbfclose(fd); -} - -static void -hsa_ndv_wr_init(const char* fname) -{ - ofd = gbfopen(fname, "w", MYNAME); -} - -static void -hsa_ndv_wr_deinit(void) -{ - gbfclose(ofd); -} - -static int legNum = 0; - -static void -hsa_ndv_waypt_pr(const waypoint* waypointp) -{ - - gbfprintf(ofd, "\t\t\n"); - - gbfprintf(ofd, "\t\t\twaypnt\n"); -//ignore these for now, they are s57 specific -// fprintf(ofd, "\t\t\t0\n"); -// fprintf(ofd, "\t\t\t1\n"); -// fprintf(ofd, "\t\t\t1089009023\n"); - gbfprintf(ofd, "\t\t\t\n", routeName, waypointp->shortname, legNum, waypointp->description); - gbfprintf(ofd, "\t\t\t\n", routeName); - gbfprintf(ofd, "\t\t\t1\n"); - gbfprintf(ofd, "\t\t\t%lf\n", waypointp->latitude); - gbfprintf(ofd, "\t\t\t%lf\n", waypointp->longitude); - - gbfprintf(ofd, "\t\t\n"); - - legNum++; -} - -static void -hsa_ndv_write(void) -{ - gbfprintf(ofd, "\n"); - gbfprintf(ofd, "\n"); - gbfprintf(ofd, "\t\n"); - gbfprintf(ofd, "\t\t1.0000000\n"); - gbfprintf(ofd, "\t\tROUTENAME\n"); /*TODO: used filename? */ - gbfprintf(ofd, "\t\t0\n"); - waypt_disp_all(hsa_ndv_waypt_pr); - gbfprintf(ofd, "\t\n"); - -//later we'll import past tracks and chart objects? -// fprintf(ofd, "\t\n"); -// fprintf(ofd, "\t\t1.0000000\n"); -// track_disp_all(hsa_ndv_track_pr); -// fprintf(ofd, "\t\n"); - - - gbfprintf(ofd, "\n"); -} - -ff_vecs_t HsaEndeavourNavigator_vecs = { - ff_type_file, - FF_CAP_RW_WPT, - hsa_ndv_rd_init, - hsa_ndv_wr_init, - hsa_ndv_rd_deinit, - hsa_ndv_wr_deinit, - hsa_ndv_read, - hsa_ndv_write, - NULL, - hsa_ndv_args, - CET_CHARSET_ASCII, 0 /* CET-REVIEW */ -}; - -////////////////////////////////////////////////////////////////////////// -// older style Endeavour route export file -//read DEC2000 NDV export files - -#define EF_RECORD_DELIMTER 0 -#define ED_REC_NAME_SIZE 5 -#define EF_NVER_REC "nver=" -#define EF_LAT_REC "lati=" -#define EF_LONG_REC "long=" -#define EF_TIME_REC "time=" -#define EF_ATTR_REC "attr=" -#define EF_CLNM_REC "clnm=" -#define INVALID_TIME -1L -#define SOUNDARRAY_CHAR 'S' - -static int readRecord(gbfile* pFile, const char* pRecName, char* recData); -static int readPositionRecord(gbfile* pFile, double* lat, double* lng, long* timeStamp); - -static void readVersion4(gbfile* pFile) -{ - while (TRUE) { - char recData[256] = {0}; - // get the position - double lat2, lng2 = 0; - - // set the pointer to the time stamp depending - // on whether we have a sounding array or not - long ts2; - long* pts2 = 0; - - int soundArray = FALSE; - int numberOfVerticies = 0; - char className[256]; - char attr[1024]; - int Vertex; - - memset(attr, 0, sizeof(attr)); - - wpt_tmp = waypt_new(); - - // read the first record - if (!readRecord(pFile, EF_NVER_REC, recData)) - // no first record then finished - { - break; - } - - // get the type - sscanf((const char*)recData, "%d", &numberOfVerticies); - - // do we have a sounding array - if (*((const char*)recData + strlen(recData) - 1) == SOUNDARRAY_CHAR) { - soundArray = TRUE; - } - - if (soundArray) { - pts2 = &ts2; - } - - // go through the vertices - for (Vertex = 0; Vertex < numberOfVerticies; Vertex++) { - // read vertex position - if (!readPositionRecord(pFile, &lat2, &lng2, pts2)) { - waypt_free(wpt_tmp); - return; - } - - wpt_tmp->longitude = lng2; - wpt_tmp->latitude = lat2; - break;//TODO: ignore more points for now - } - - - // read the class name - if (!readRecord(pFile, EF_CLNM_REC, className)) { - waypt_free(wpt_tmp); - return; - } - - // read the attributes name - if (!readRecord(pFile, EF_ATTR_REC, attr)) { - waypt_free(wpt_tmp); - return; - } - getAttr(attr, ATTR_OBJECTNAME, &wpt_tmp->shortname, '\x1f'); - getAttr(attr, ATTR_USRMRK, &wpt_tmp->description, '\x1f'); - - { - char* bad; - //remove \n and \x1f from description data - while (NULL != (bad = strchr(wpt_tmp->description, '\x1f'))) { - *bad = REPLACEMENT_SIRIUS_ATTR_SEPARATOR; - } - while (NULL != (bad = strchr(wpt_tmp->description, '\n'))) { - *bad = ' '; - } - while (NULL != (bad = strchr(wpt_tmp->description, '\r'))) { - *bad = ' '; - } - } - - waypt_add(wpt_tmp); - } - - gbfclose(pFile); - return; -} - -// read a record to a file -static int readRecord(gbfile* pFile, const char* pRecName, char* recData) -{ - // get the rec name - int len; - char recName[ED_REC_NAME_SIZE+1]; - char arrRecData[256]; - - for (len = 0; len < ED_REC_NAME_SIZE; len++) { - int c = gbfgetc(pFile); - - // if we hit EOF failed - if (c == EOF) { - return FALSE; - } - - recName[len] = c; - } - - // if the record name is not the reqiured type then error - if (strncmp(recName, pRecName, ED_REC_NAME_SIZE) != 0) { - return FALSE; - } - - // get the rec data - for (len = 0; TRUE; len++) { - int c = gbfgetc(pFile); - - // if we hit EOF failed - if (c == EOF) { - return FALSE; - } - - // hit end of line - if (c == EF_RECORD_DELIMTER) { - break; - } - - arrRecData[len] = c; - } - - // get the rec data to a string - strncpy(recData, arrRecData, len); - - return TRUE; -} - -// read position -static int readPositionRecord(gbfile* pFile, double* lat, double* lng, - long* timeStamp) -{ - // read the lat record - char recData[256] = {0}; - - if (!readRecord(pFile, EF_LAT_REC, recData)) - // no lat record then finished - { - return FALSE; - } - - // read the latitude - sscanf((const char*)recData, "%lf", lat); - - // read the lng record - if (!readRecord(pFile, EF_LONG_REC, recData)) - // no first record then finished - { - return FALSE; - } - - // read the latitude - sscanf((const char*)recData, "%lf", lng); - - // if we are to read a time record - if (timeStamp) { - // read the lng record - if (!readRecord(pFile, EF_TIME_REC, recData)) - // no first record then finished - { - return FALSE; - } - - // read the latitude - sscanf((const char*)recData, "%ld", timeStamp); - } - - return TRUE; -} diff --git a/gpsbabel/xmlgeneric.cc b/gpsbabel/xmlgeneric.cc index af43e47a1..196314029 100644 --- a/gpsbabel/xmlgeneric.cc +++ b/gpsbabel/xmlgeneric.cc @@ -45,91 +45,8 @@ static const char* xg_encoding; static QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8"); static QTextCodec* codec = utf8_codec; // Qt has no vanilla ASCII encoding =( -#define MY_CBUF 4096 - #define MYNAME "XML Reader" -void -write_xml_header(gbfile* ofd) -{ - char buff[128]; - cet_cs_vec_t* cs = cet_find_cs_by_name(CET_CHARSET_ASCII); - - if ((global_opts.charset != NULL) && (global_opts.charset != cs)) { - snprintf(buff, sizeof(buff), " encoding=\"%s\"", global_opts.charset_name); - QTextCodec* tcodec = QTextCodec::codecForName(global_opts.charset_name); - if (tcodec) { - codec = tcodec; - } - } else { - buff[0] = 0; - } - - gbfprintf(ofd, "\n", buff); -} - -void -write_xml_entity(gbfile* ofd, const QString& indent, - const QString& tag, const QString& value) -{ - char* tmp_ent = xml_entitize(CSTRE(value)); - gbfprintf(ofd, "%s<%s>%s\n", CSTRE(indent), CSTRE(tag), tmp_ent, - CSTRE(tag)); - xfree(tmp_ent); -} - -void -write_optional_xml_entity(gbfile* ofd, const QString& indent, - const QString& tag, const QString& value) -{ - if (!value.isEmpty()) { - write_xml_entity(ofd, indent, tag, value); - } -} - -void -write_xml_entity_begin0(gbfile* ofd, const QString& indent, - const QString& tag) -{ - gbfprintf(ofd, "%s<%s>\n", CSTRE(indent), CSTRE(tag)); -} - -void -write_xml_entity_begin1(gbfile* ofd, const QString& indent, - const QString& tag, const QString& attr, - const QString& attrval) -{ - gbfprintf(ofd, "%s<%s %s=\"%s\">\n", CSTRE(indent), CSTRE(tag), CSTRE(attr), - CSTRE(attrval)); -} - -void -write_xml_entity_begin2(gbfile* ofd, const QString& indent, - const QString& tag, const QString& attr1, - const QString& attrval1, const QString& attr2, - const QString& attrval2) -{ - gbfprintf(ofd, "%s<%s %s=\"%s\" %s=\"%s\">\n", CSTRE(indent), CSTRE(tag), - CSTRE(attr1), CSTRE(attrval1), CSTRE(attr2), CSTRE(attrval2)); -} - -void -write_xml_entity_end(gbfile* ofd, const QString& indent, - const QString& tag) -{ - gbfprintf(ofd, "%s\n", CSTRE(indent), CSTRE(tag)); -} - -void -xml_write_time(gbfile* ofd, gpsbabel::DateTime dt, const char* elname) -{ - gbfprintf(ofd, "<%s>%s\n", - elname, - CSTRE(dt.toPrettyString()), - elname - ); -} - /*********************************************************************** * These implement a simple interface for "generic" XML that * maps reasonably close to 1:1 between XML tags and internal data diff --git a/gpsbabel/xmlgeneric.h b/gpsbabel/xmlgeneric.h index d2897f0dd..5bc1b76a7 100644 --- a/gpsbabel/xmlgeneric.h +++ b/gpsbabel/xmlgeneric.h @@ -36,23 +36,6 @@ typedef struct xg_tag_mapping { } xg_tag_mapping; extern const char* xhtml_entities; - -void write_xml_entity(gbfile* ofd, const QString& indent, - const QString& tag, const QString& value); -void write_xml_entity_begin0(gbfile* ofd, const QString& indent, - const QString& tag); -void write_xml_entity_begin1(gbfile* ofd, const QString& indent, - const QString& tag, const QString& attr1, - const QString& attrval1); -void write_xml_entity_begin2(gbfile* ofd, const QString& indent, const QString& tag, - const QString& attr1, const QString& attrval1, - const QString& attr2, const QString& attrval2); -void write_xml_entity_end(gbfile* ofd, const QString& indent, const QString& tag); - -void write_optional_xml_entity(gbfile* ofd, const QString& indent, - const QString& tag, const QString& value); -void xml_write_time(gbfile* ofd, gpsbabel::DateTime time, const char* elname); -void write_xml_header(gbfile* ofd); void xml_ignore_tags(const char** taglist); void xml_init(const char* fname, xg_tag_mapping* tbl,const char* encoding); -- 2.30.2